//
//  FeaturesServiceCell.m
//  BigToBig
//
//  Created by 毛丽媛 on 16/8/1.
//  Copyright © 2016年 cn.cloudtp. All rights reserved.
//

#import "FeaturesServiceCell.h"


@implementation FeaturesServiceCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews{
    for (NSInteger i = 0; i < 11; i++) {
        if (i < 3) {
            self.aView = [[UIView alloc] initWithFrame:CGRectMake(i*(kScreenWidth - 120)/3 + 30*(i + 1), 20 , (kScreenWidth - 120)/3, (kScreenWidth - 60)/3)];
//            self.aView.backgroundColor = [UIColor yellowColor];
            [self.contentView addSubview:self.aView];
        }if (i>= 3 && i<6) {
            self.aView = [[UIView alloc] initWithFrame:CGRectMake((i - 3)*(kScreenWidth - 120)/3 + 30*(i-2), 20*2 + (kScreenWidth - 60)/3, (kScreenWidth - 120)/3, (kScreenWidth - 60)/3)];
           // self.aView.backgroundColor = [UIColor yellowColor];
            [self.contentView addSubview:self.aView];
        }if (i>= 6 && i<9) {
            self.aView = [[UIView alloc] initWithFrame:CGRectMake((i - 6)*(kScreenWidth - 120)/3 + 30*(i-5), 20*3 + (kScreenWidth - 60)/3 + (kScreenWidth - 60)/3, (kScreenWidth - 120)/3, (kScreenWidth - 60)/3)];
            //self.aView.backgroundColor = [UIColor yellowColor];
            [self.contentView addSubview:self.aView];
        }if (i >= 9 && i < 11) {
            self.aView = [[UIView alloc] initWithFrame:CGRectMake((i - 9)*(kScreenWidth - 120)/3 + 30*(i-8), 20*4 + (kScreenWidth - 60)/3 + (kScreenWidth - 60)/3 + (kScreenWidth - 60)/3 , (kScreenWidth - 120)/3, (kScreenWidth - 60)/3)];
            //self.aView.backgroundColor = [UIColor yellowColor];
            [self.contentView addSubview:self.aView];
        }
        
        self.wordArr = [NSMutableArray arrayWithObjects:@"人才公寓",@"路演厅",@"税务代理",@"会议室",@"行政帮助",@"公司注册",@"停车位",@"创业辅导",@"投融资对接",@"文印一体",@"营销推广", nil];
        
        self.picArr = [NSMutableArray arrayWithObjects:@"家庭公寓",@"演播厅",@"小规模纳税人企业代理记账",@"会议厅",@"行政帮助",@"公司注册",@"停车位",@"创业辅导",@"投融资对接",@"文印一体",@"营销推广", nil];

        self.image = [UIButton buttonWithType:UIButtonTypeCustom];
        self.image.frame = CGRectMake(8, 8, (kScreenWidth - 120)/3 - 16, (kScreenWidth - 120)/3 - 16);
        //self.image.backgroundColor = [UIColor cyanColor];
        [self.aView addSubview:self.image];
        
        self.nameLab = [[UILabel alloc] initWithFrame:CGRectMake(0,(kScreenWidth - 120)/3,(kScreenWidth - 120)/3,(kScreenWidth - 60)/3 - (kScreenWidth - 120)/3)];
//        self.nameLab.backgroundColor = [UIColor yellowColor];
        self.nameLab.textColor = COLOR_RGBA(254, 122, 104, 1);
        self.nameLab.textAlignment = NSTextAlignmentCenter;
        self.nameLab.font = [UIFont systemFontOfSize:12];
        [self.aView addSubview:self.nameLab];
       
        self.nameLab.text = _wordArr[i];
        [self.image setImage:[UIImage imageNamed:_picArr[i]] forState:UIControlStateNormal];
        
//           self.wordArr = [NSMutableArray arrayWithObjects:@"人才公寓",@"路演厅",@"税务代理",@"会议室",@"行政帮助",@"公司注册",@"停车位",@"创业辅导",@"更多", nil];
//           self.picArr = [NSMutableArray arrayWithObjects:@"家庭公寓",@"演播厅",@"小规模纳税人企业代理记账",@"会议厅",@"行政帮助",@"公司注册",@"停车位",@"创业辅导",@"更多", nil];
    
        
        if (i == 8) {
            [self.image addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchDown];
        }
        
    }
}

- (void)click:(UIButton *)btn{
   
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
